using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using ViCode_LeVi.Controls.Charts;
using ViCode_LeVi.Controls.Logs;

namespace ViCode_LeVi.Controls.Reports
{
    public partial class FactorSubReport : DevExpress.XtraReports.UI.XtraReport
    {        
        public FactorSubReport()
        {
            this.InitializeComponent();
        }
        private FactorType m_eEFType;
        private bool CreateDataBindings()
        {
            bool flag = true;
            try
            {
                this.cellID.DataBindings.Add("Text", base.DataSource, "ID");
                this.cellName.DataBindings.Add("Text", base.DataSource, "FactorName");
                this.cellDefinition.DataBindings.Add("Text", base.DataSource, "Definition");
            }
            catch (Exception exception)
            {
                flag = false;
                //rsErr = "Fehler in FactorSubReport.CreateDataBindings: " + exception.Message;
                Log.LogException(exception);
            }
            return flag;
        }

        public bool CreateReport(ref bool bFactors)
        {
            bool flag = true;
            try
            {
                this.cellEFType.Text = FactorType_Helper.GetFactorTypeString(this.EFType);
                var data = new ReportDataSourceHelper().GetReportFactorList(this.EFType);
                base.DataSource = data;
                if (data.Length> 0)
                {
                    bFactors = true;
                    return this.CreateDataBindings();
                }
                bFactors = false;
            }
            catch (Exception exception)
            {
                flag = false;
                //rsErr = "Fehler in ActionSubReport.CreateReport: " + exception.Message;
                Log.LogException(exception);
            }
            return flag;
        }
       
        

    

        public FactorType EFType
        {
            get
            {
                return this.m_eEFType;
            }
            set
            {
                this.m_eEFType = value;
            }
        }

    }
}
